@extends('layout.index')

@section('title', '订单管理')

@section('content')
<div class="mws-panel grid_8">
  <div class="mws-panel-header">
    <span>
      <i class="icon-table"></i>订单列表</span>
  </div>
  <div class="mws-panel-body no-padding">
    <div role="grid" class="dataTables_wrapper" id="DataTables_Table_1_wrapper">
      <form action="/admin/orders/index" method="get">
          <div id="DataTables_Table_1_length" class="dataTables_length">
            <label>显示
              <select name="num" size="1" aria-controls="DataTables_Table_1">
                <option value="10" @if(!empty($request['num']) && $request['num'] == 10)
                                        selected
                                    @endif>10</option>
                <option value="25" @if(!empty($request['num']) && $request['num'] == 25)
                                        selected
                                    @endif>25</option>
                <option value="50" @if(!empty($request['num']) && $request['num'] == 50)
                                        selected
                                    @endif>50</option>
                <option value="100" @if(!empty($request['num']) && $request['num'] == 100)
                                        selected
                                    @endif>100</option>
                </select>条
            </label>
          </div>
          <div class="dataTables_filter" id="DataTables_Table_1_filter">
            <label>关键字:
              <input name="keywords" value="{{$request['keywords'] or ''}}" type="text" aria-controls="DataTables_Table_1">
              <button class="btn btn_default">查询</button>
            </label>
          </div>
      </form>
      <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
        <thead>
          <tr role="row">
            <th class="ordersing_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 31px;" aria-orders="ascending" aria-label="Rendering engine: activate to orders column descending">orderid</th>
            <th class="ordersing_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 31px;" aria-orders="ascending" aria-label="Rendering engine: activate to orders column descending">用户ID</th>
            <th class="ordersing" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 53px;" aria-label="Browser: activate to orders column ascending">订单编号</th>
            <th class="ordersing" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 179px;" aria-label="Platform(s): activate to orders column ascending">收货地址</th>
            <th class="ordersing" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 120px;" aria-label="Engine version: activate to orders column ascending">订单状态</th>
            <th class="ordersing" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 53px;" aria-label="Browser: activate to orders column ascending">订单总价</th>
            <th class="ordersing" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 86px;" aria-label="CSS grade: activate to orders column ascending">操作</th></tr>
        </thead>
        <tbody role="alert" aria-live="polite" aria-relevant="all">
        @foreach($orders as $k=>$v)
          <tr class="@if($k%2 == 0)
                    odd
                    @else
                    even
                    @endif
                    ">
            <td class="  ordersing_1">{{$v->orderid}}</td>
            <td class=" ">{{$v->userid}}</td>
            <td class=" ">{{$v->order_code}}</td>
            <td class=" ">{{$v->address}}</td>
            <td class=" ">{{str_replace([0,1,2,3],['已下单','已付款','已发货','已完成'],$v->stat)}}</td>
            <td class=" ">{{$v->orderprice}}</td>
            <td class=" ">
                <a href="/admin/orders/edit/{{$v->orderid}}" style="color:black;"><i class="icon-tools"></i>修改状态</a>
            </td>
          </tr>
        @endforeach
        </tbody>
      </table>
      <div class="dataTables_paginate paging_full_numbers" id="pages">
        {!! $orders->appends($request)->render() !!}
      </div>
    </div>
  </div>
</div>
@endsection